// vim:set tabstop=4 shiftwidth=4 softtabstop=4 expandtab foldcolumn=1 foldmethod=marker:
/**
 * Project: LteERP
 * File:    src/filter/SetCharacter.java
 *
 * Set the jsp, servlet input character to UTF-8
 * for internation language
 *
 * @package:    com.m5anet.filter;
 * @author:     Mike.G  (hylinux@gmail.com)
 * @license:    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1 
 * @copyright:  http://www.5anet.com
 */
package com.m5anet.filter;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

public final class SetCharacter implements Filter {

    public void doFilter(
            ServletRequest req,
            ServletResponse res,
            FilterChain chain ) throws IOException, ServletException {

        req.setCharacterEncoding("UTF-8");
        chain.doFilter(req, res);

    }

    public void destroy() {

    }

    public void init(FilterConfig config) {

    }

}
